package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.Question;
import com.tanhua.domain.db.Settings;
import com.tanhua.dubbo.mapper.QuestionMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class QuestionApiImpl implements QuestionApi  {
    @Autowired
    private QuestionMapper questionMapper;

    /**
     * 根据用户ID查询问题表
     * @param id
     * @return
     */
    @Override
    public Question getQuestById(Integer id) {
        LambdaQueryWrapper<Question> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Question::getUserId,id);
       return questionMapper.selectOne(queryWrapper);
    }
    //根据用户ID修改表
    @Override
    public void saveMessage(Question question) {
        questionMapper.insert(question);
    }
}
